Skip to content

feat(providers): add GitHub Copilot CLI provider#480

Closed
sykuang wants to merge 3 commits into
the-open-engine:mainfrom
sykuang:feat/copilot-provider
Closed

feat(providers): add GitHub Copilot CLI provider#480
sykuang wants to merge 3 commits into
the-open-engine:mainfrom
sykuang:feat/copilot-provider

Conversation

@sykuang

@sykuang sykuang commented Apr 21, 2026

Copy link
Copy Markdown

Summary

Adds a new copilot provider that wraps the official GitHub Copilot CLI (@github/copilot), alongside the existing claude / codex / gemini / opencode providers.

What's included

  • src/providers/copilot/{index,cli-builder,output-parser,models}.js
  • Registered in src/providers/index.js, src/providers/capabilities.js, lib/provider-names.js (aliases: copilot, github)
  • Docs section appended to docs/providers.md
  • 20 new unit tests in tests/unit/copilot-provider.test.js

CLI mapping

copilot -p "<prompt>" --silent [--allow-all] [--model <name>]
  • Auth: copilot then /login (GitHub Copilot subscription)
  • Models exposed: gpt-5-mini (level1), claude-sonnet-4.5 (level2), claude-opus-4.6 (level3); plus gpt-5

Capabilities

dockerIsolation worktreeIsolation mcpServers jsonSchema streamJson thinkingMode reasoningEffort
experimental (prompt-injected)

Caveats

  • Copilot CLI emits plain text with --silent (no structured JSON stream). The parser yields text events per line; completion is signaled by process exit (no synthetic result event with token usage).
  • jsonSchema is enforced by appending an "OUTPUT FORMAT" block to the prompt — same pattern as opencode/gemini.
  • No native MCP server support exposed via the CLI.

Tests

  • 20 new tests pass.
  • No regressions: pre-existing failures (Python 3.9 syntax in hooks/block-dangerous-git.py) unchanged from baseline.

sykuang added 2 commits April 21, 2026 10:12
Copilot CLI loads MCP from ~/.copilot/mcp-config.json and accepts
per-run augmentation via --additional-mcp-config (JSON or @file).

- capabilities.copilot.mcpServers: false → true
- cli-builder: emit --additional-mcp-config per entry (string|object|array)
- cli-builder: add addDirs → repeated --add-dir flags
- index: detect --additional-mcp-config / --add-dir / --config-dir support
- runner: thread providerSettings.mcpConfig + addDirs into buildCommand
- docs: MCP servers section with example providerSettings
- tests: +5 cases (object/string/array/disabled/addDirs), 25/25 green
@sykuang

sykuang commented Apr 21, 2026

Copy link
Copy Markdown
Author

Follow-up: added Copilot CLI MCP support (commit 4d2b192).

Turns out the Copilot CLI does expose MCP via:

  • default config file ~/.copilot/mcp-config.json
  • per-run flag --additional-mcp-config <json|@file> (repeatable; augments user config)
  • built-in GitHub MCP toggles --add-github-mcp-tool / --add-github-mcp-toolset

Changes:

  • capabilities.copilot.mcpServers: falsetrue
  • cli-builder: emit --additional-mcp-config per entry, accepts string / object / @file / array; also added addDirs → repeated --add-dir
  • index.js: feature-detect --additional-mcp-config / --add-dir / --config-dir
  • task-lib/runner.js: thread providerSettings.mcpConfig and providerSettings.addDirs into buildCommand
  • docs: new MCP servers section with a providerSettings.copilot.mcpConfig example
  • tests: +5 cases (string / object / array+@file / disabled / addDirs); 25/25 green

Source: copilot --help lists --additional-mcp-config, --add-github-mcp-tool, --add-github-mcp-toolset, and --config-dir (default ~/.copilot).

…lidator

- cli/index.js: include 'copilot' in --provider option description
- src/preflight.js: add copilot validator + update unknown-provider hint
@mkceichelbeck

Copy link
Copy Markdown
Contributor

Hey @sykuang, thank you for this, and sorry it took us a while to circle back.
Your CLI mapping and the MCP follow-up saved us real time building the MCP support.
Excellent feature intuition on this, really appreciate it. 🎉

The interfaces had shifted and we have now shipped a Copilot provider in #603 (provider engine) and #622 (MCP + Docker), so I'm closing this PR.

Would love to have you contribute in the future and I promise we will be a lot faster at reviewing PRs!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants